﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Guns_Project_Form_
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            int[,] guns  new int[4, 3];
            guns[0, 0] = Convert.ToInt32(HgunNum.Text);
            guns[0, 1] = Convert.ToInt32(HgunCost.Text);
            guns[0, 2] = guns[0, 0] * guns[0, 1];

            guns[1, 0] = Convert.ToInt32(CgunNum.Text);
            guns[1, 1] = Convert.ToInt32(CgunCost.Text);
            guns[1, 2] = guns[1, 0] * guns[1, 1];

            guns[2, 0] = Convert.ToInt32(ArmNum.Text);
            guns[2, 1] = Convert.ToInt32(ArmCost.Text);
            guns[2, 2] = guns[2, 0] * guns[2, 1];

            guns[3, 0] = Convert.ToInt32(SolNum.Text);
            int min = guns[0, 0]; 
            for (int i = 0; i < 3; i++)
                if (min > guns[i, 0])
                    min = guns[i, 0];    
            guns[3, 1] = min;
            guns[3, 2] = guns[0, 2] + guns[1, 2] + guns[2, 2];
            HgunSum.Text = Convert.ToString(guns[0, 2]);
            CgunSum.Text = Convert.ToString(guns[1, 2]);
            ArmSum.Text = Convert.ToString(guns[2, 2]);
            SolWNum.Text = Convert.ToString(guns[3, 1]);
            AllSum.Text = Convert.ToString(guns[3, 2]);
        }

    }
}
